﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MySoftWare.DataAccess;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

namespace MySoftWare.SimpleMVC.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.Message = "欢迎使用 ASP.NET MVC!";
            
            DBHelper.ConnectionString = DBUtils.DbConnectionString;
            string commandtext = "select au_lname,au_fname from dbo.authors order by au_lname";
            string strConn=ConfigurationManager.ConnectionStrings["DbConn"].ConnectionString;
            SqlConnection conn = new SqlConnection(strConn);
            conn.Open();
            SqlCommand cmd = new SqlCommand(commandtext);
            cmd.Connection = conn;
            int ii=cmd.ExecuteNonQuery();
            DataTable dt= DBHelper.ExecuteDataTable(commandtext);
            int i = DBHelper.ExecuteNonQuery(commandtext);
            return View();
        }

        public ActionResult About()
        {
            return View();
        }
    }
}
